package com.um.jdy.mp.station.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.um.jdy.mp.station.entity.dto.FeeEBoxDTO;
import com.um.jdy.mp.station.entity.vo.FeeEBoxVO;
import com.um.jdy.mp.station.manager.*;
import com.um.springboot.starter.orm.controller.BaseController;
import com.um.springboot.starter.orm.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 方案管理
 *
 * @author cs
 * 日期 2023/5/25
 * 版权所有 广州优匠科技有限公司
 */
@Api(tags = "方案管理-充电柜方案")
@Validated
@RestController
@RequestMapping("/api/v1/cms/fee/ebox")
@SaCheckLogin
public class FeeEBoxController extends BaseController<FeeEBoxManager> {

    /**
     * 详情
     * @param id
     * @return
     */
    @ApiOperation(value = "详情")
    @GetMapping("/{id}")
    public Response<FeeEBoxVO> get(@ApiParam(value = "方案id") @PathVariable String id) {
        return Response.success(manager.get(id));
    }

    /**
     * 新增
     * @param dto
     * @return
     */
    @ApiOperation(value = "新增")
    @PostMapping("")
    public Response<FeeEBoxVO> add(@RequestBody FeeEBoxDTO dto) {
        return Response.success(manager.add(dto));
    }

    /**
     * 编辑
     * @param id
     * @param dto
     * @return
     */
    @ApiOperation(value = "编辑")
    @PutMapping("/{id}")
    public Response<FeeEBoxVO> update(@ApiParam(value = "方案id") @PathVariable String id,
                                   @RequestBody FeeEBoxDTO dto) {
        return Response.success(manager.update(id, dto));
    }

}
